package ltd.yangyh.service;

import ltd.yangyh.bean.Book;
import ltd.yangyh.mapper.BookMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class BookService {
    @Resource
    private BookMapper bookMapper;

    public List<Book> getAllBook() {
        return bookMapper.listByAll();
    }

    public void addBook(Book book) {
        bookMapper.addOneByBean(book);
    }

    public Book QueryBookById(Integer id) {
        return bookMapper.SelectOneById(id);
    }

    public void updateBookById(Book book) {
        bookMapper.updateByBookId(book);
    }

    public void deleteBookById(Integer id) {
        bookMapper.deleteById(id);
    }
}
